Skip to content

fix(mcp): preserve transport event deadline values and provenance - #437

Merged
dodeja merged 2 commits into
mainfrom
fix/mcp-transport-event-values
Oct 17, 2026
Merged

dodeja merged 2 commits into
mainfrom
fix/mcp-transport-event-values

Conversation

@alosec

@alosec alosec commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review follow-up — a3f4c0e

Addressed Maurycy's review: active-only milestones/categories and compact summaries; withdrawn history retained in the full timeline; concrete latest-event/formatter types; opaque reported JSON preserved only at the two event-value paths; final-response tests on both tools; shorter tool description with detailed guidance in the query resource. All five review threads answered and resolved. Remote checks pending; no merge or live customer verification.

Summary

Fixes DEV-13524: preserve public transport-event value, data_source, and invalidated_at instead of discarding them during MCP formatting.

  • Applies to the dedicated timeline endpoint and its container-include fallback, plus the compact snapshot's latest-event summary.
  • Uses the same tool description for registered discovery and the standalone definition, documenting reported deadline values versus event timestamps; the longer playbook lives in the query-guidance resource.
  • Keeps values as supplied (including structured JSON, false, zero, and empty strings); absent values become null. Does not infer or calculate deadlines.

For container.detention_lfd_line.changed, the deadline is the API's value, not timestamp. Pickup LFD remains separate and unchanged. This fixes information loss where an event is reported; it does not establish carrier coverage or promise an empty-return deadline for every container. No t49/backend changes, agent prompt changes, auth changes, or SQL-tool dependencies.

Verification

  • 430 MCP tests pass, including the original 17 executor regressions and 10 registered-response regressions. The full workspace suite also passes: 359 SDK + 31 CLI tests, with one existing SDK skip.
  • Repository npm run check passes (existing lint warnings remain).
  • SDK and MCP builds pass.
  • All six supported MCP protocol smoke versions pass.
  • git diff --check passes.
  • Synthetic fixtures only; no live customer calls or deployment verification.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with non-blocking fixes recommended for structured values and the snapshot return type.

Fix All in CodexFindings

  1. P2 Reported fields can disappear ▶
  2. P2 New fields lack types ▶
Fix with agent prompt
### Issue 1
packages/mcp/src/tools/get-container-transport-events.ts:220
Structured `value` objects can still lose fields in actual MCP responses. `wrapTool` passes the whole result through `stripResponseSteering`, which recursively removes `_agent_steering` and `_response_contract`, plus fields such as `recommendations` beneath any `_metadata` key. For example, `{"_metadata":{"recommendations":["reported"]}}` becomes `{"_metadata":{}}`. This affects both the timeline and compact snapshot.

Keep reported event values outside this cleanup and add a test through the registered tool; the new executor tests stop before this step. Greptile automatically discovered a related ticket stating that structured event values must be preserved, which informed this comment.

### Issue 2
packages/mcp/src/tools/get-container.ts:388-390
`formatEventsData` now returns `value`, `data_source`, and `invalidated_at`, but `ContainerStatus.events.latest_event` still declares only `event`, `timestamp`, and `location`. Since `executeGetContainer` returns `Promise<ContainerStatus>`, TypeScript callers cannot access the new fields without a cast.

Add these fields to the declared return type, using `unknown` for arbitrary reported `value`.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Preserves reported transport-event values, sources, and withdrawal dates in timeline and compact snapshot responses.

  • Transport timelines keep each event’s reported details.
  • Container snapshots keep the latest event’s reported details.

Reviews (1) · Last reviewed commit: "fix(mcp): preserve transport event value..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api Ready Ready Preview Oct 16, 2026 5:27pm UTC

Request Review

@linear-code

linear-code Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

DEV-13524

@alosec
alosec marked this pull request as ready for review October 16, 2026 00:10
Comment thread packages/mcp/src/tools/get-container-transport-events.ts
Comment thread packages/mcp/src/tools/get-container.ts

@maurycy maurycy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed against tnt-api: LineDetentionLastFreeDayChangedTransportEventCreator writes the deadline into value_timestamp and the report time into timestamp, so reading value as the deadline is correct.

Comment thread packages/mcp/src/tools/get-container-transport-events.ts
Comment thread packages/mcp/src/tools/get-container-transport-events.ts Outdated
Comment thread packages/mcp/src/tools/contracts.test.ts

@maurycy maurycy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified a3f4c0e against all five review threads. The requested code, typing, guidance, and final MCP response regression coverage are addressed. Approving the changes. The failing MCP preview 2026-07-28 check still needs investigation before merge: fixture discovery fails on list_shipments before the tool eval cases run.

@dodeja

dodeja commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

@maurycy, about the "MCP preview 2026-07-28" failure in your approval note: this PR doesn't cause it. The live eval credential is broken for every run, on PRs and on main.

  • The failure on this PR (run 38939680967) happens at fixture discovery, before any eval case runs: Fixture discovery list_shipments failed (HTTP 200, tool error: true); check eval credentials and upstream availability.
  • Main's own mcp job fails with the same error on the current HEAD 2e2f997 (run 39010910887). It also failed on a91ae46 and 15fa053. Every main CI run since 2026-10-14 is red for this reason.
  • The same preview leg fails on PRs that don't touch the MCP code, including docs-only docs(coverage): add changelog entry for Seaboard Marine public listing #434. Only the 2026-07-28 leg runs the live eval, which is why the 2025-11-25 leg passes.

The fix is to rotate MCP_EVAL_TOKEN, or point it at an account that has tracked shipments. That fix belongs outside this PR.

I also checked this branch against current main (2e2f997, which now includes #420, #438, #439, #440 and #441). It merges cleanly, with no conflicts. On the merged tree, vp run check passes and vp run --filter @terminal49/mcp test passes (470/470). I didn't rebase because nothing needed it. Every other required check on this PR is green.

@dodeja
dodeja merged commit 56d68da into main Oct 17, 2026
48 of 50 checks passed
dodeja added a commit that referenced this pull request Oct 17, 2026
Brings in #434, #437 and #444. The only conflict was the generated
Terminal49-API.postman_collection.json. This branch does not change
docs/openapi.json, so it takes main's generated collection unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dodeja added a commit that referenced this pull request Oct 17, 2026
Brings in #434, #437 and #444. The only conflict was the generated
Postman collection: took main's copy and regenerated it from the merged
docs/openapi.json with openapi-to-postmanv2@6.3.0. SDK types, MCP filter
schemas and SDK reference docs regenerate unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dodeja added a commit that referenced this pull request Oct 17, 2026
…fixture

Main's #437 event-value test expected get_container to report the legacy
flat pickup_lfd. This branch reads the deadline only from
import_deadlines.pod.unified, so the fixture now supplies that value and a
different legacy value, keeping the check that event values never replace the
container's own deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — a3f4c0ed Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants